﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="left.aspx.cs" Inherits="Easy.Web.Pages.DataPages.left" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
    <script src="/_js/jquery-1.9.1.min.js"></script>
    <link href="/_css/bootstrap.min.css" rel="stylesheet" type="text/css" />
    <style>
        * {
            font-size: 9pt;
            border: 0;
            margin: 0;
            padding: 0;
        }

        body {
            font-family: '微软雅黑';
            margin: 0 auto;
            height: 100%;
        }

        body {
            background: rgb(204,204,204);
        }

        ul {
            display: block;
            margin: 0;
            padding: 0;
            list-style: none;
        }

        li {
            display: block;
            margin: 0;
            padding: 0;
            list-style: none;
        }

        img {
            border: 0;
        }

        dl, dt, dd, span {
            margin: 0;
            padding: 0;
            display: block;
        }

        a, a:focus {
            text-decoration: none;
            color: #FFFFFF;
            outline: none;
            blr: expression(this.onFocus=this.blur());
        }

            a:hover {
                color: #FFFFFF;
                text-decoration: none;
            }

        table {
            border-collapse: collapse;
            border-spacing: 0;
        }

        cite {
            font-style: normal;
        }

        h2 {
            font-weight: normal;
        }

        .leftmenu {
            width: 187px;
            overflow-y: scroll;
        }

            .leftmenu dd {
                background: rgb(52,73,94);
                line-height: 35px;
                color: #FFFFFF;
                font-weight: bold;
                font-size: 14px;
            }

                .leftmenu dd span {
                    float: left;
                    margin: 10px 8px 0 12px;
                    height: 16px;
                    width: 16px;
                }

                .leftmenu dd a {
                    display: block;
                }

                    .leftmenu dd a:hover {
                        background: rgb(45,63,81);
                    }

                .leftmenu dd .menuson {
                    height: 0px;
                    overflow: hidden;
                }

        .menuson {
            line-height: 30px;
            font-weight: normal;
            background: #293038;
        }

            .menuson li {
                cursor: pointer;
            }

                .menuson li:hover {
                    background: #37424F;
                }

                .menuson li.active {
                    position: relative;
                    background: #37424F;
                    line-height: 30px;
                    color: #fff;
                }

                    .menuson li.active:before {
                        content: " ";
                        position: absolute;
                        top: 0px;
                        height: 100%;
                        width: 2px;
                        background-color: rgb(67,93,120);
                    }

                .menuson li span {
                    display: block;
                    float: left;
                    margin-left: 32px;
                    width: 17px;
                    height: 17px;
                    margin-top: 7px;
                }

                .menuson li a {
                    display: block;
                    *display: inline;
                    *padding-top: 5px;
                }

                .menuson li.active a {
                    color: #fff;
                }

        ::-webkit-scrollbar {
            width: 0px;
        }

        .title.active {
            background-color: rgb(45,63,81);
        }
        /*滚动条样式**/
    </style>

</head>
<body style="background: rgb(52,73,94)">
    <div style="height: 100px; text-align: center">
        <img style="height: 100px; width: 100px" src="../../_imgs/logo.png" />
    </div>
    <form id="form1" runat="server">
        <dl class="leftmenu">
        </dl>
    </form>
    <script>
        $(document).ready(function () {
            getSiteMap1();

            $(".leftmenu").height(window.innerHeight);

        });



        function getSiteMap1() {
            $.ajax({
                url: "/Service/Data/GetSiteMap.ashx",
                async: true,
                type: "post",
                dataType: "json",
                data: {
                },
                success: function (data) {
                    var str2 = "";
                    //添加privilege为1时显示
                    for (var i = 0; i < data.length; i++) {
                        if (data[i].Privilege == 1) {

                            if (i == 0) {
                                if (data[i].Url != '')
                                { str2 += " <dd id=\"list" + (i + 1) + "\"> <div  class='title'><span class='glyphicon " + data[i].Icon + "'></span>" + "<a href='" + data[i].Url + "' target='main'>" + data[i].Name + "</a></div><ul class='menuson'>"; }
                                else
                                {
                                    str2 += " <dd id=\"list" + (i + 1) + "\"> <div  class='title'><span class='glyphicon " + data[i].Icon + "'></span>" + "<a href='#' target=''>" + data[i].Name + "</a></div><ul class='menuson'>";
                                }
                            } else {
                                if (data[i].Url != '')
                                { str2 += " </ul></dd><dd> <div  class='title'><span class='glyphicon " + data[i].Icon + "'></span>" + "<a href='" + data[i].Url + "' target='main'>" + data[i].Name + "</a></div><ul class='menuson'>"; }
                                else
                                {
                                    str2 += " </ul></dd><dd> <div  class='title'><span class='glyphicon " + data[i].Icon + "'></span>" + "<a href='#' target=''>" + data[i].Name + "</a></div><ul class='menuson'>";

                                }
                            }

                            for (var j = 0; j < data[i].ChildSiteMap.length; j++) {
                                if (data[i].ChildSiteMap[j].Privilege == 1) {
                                    str2 += "<li><span class='glyphicon " + data[i].ChildSiteMap[j].Icon + "'></span>"
                                        + "<a href='" + data[i].ChildSiteMap[j].Url + "' target='main'>" + data[i].ChildSiteMap[j].Name + "</a></li>";
                                }

                            }

                        }
                        str2 += "</ul></dd>";

                    }


                    $(".leftmenu").append(str2);


                    $(function () {
                        //导航切换
                        $(".menuson li").click(function () {
                            $(".menuson li.active").removeClass("active");
                            $(this).addClass("active");
                        });

                        $('.title').click(function () {
                            if ($(this).next('ul').height() == 0) {
                                $(this).next('ul').animate({
                                    'height': $(this).next('ul').find('li').length * 30
                                }, 300);

                                $(".title").removeClass("active");
                                $(this).addClass("active");

                                /*$(this).parent().siblings('dd').find('ul').animate({
                                    'height': 0
                                }, 300);
                                $(this).parent().siblings('dd').find('.title').find('img').css('transform', 'rotate(0deg)');*/
                            } else {
                                $(this).next('ul').animate({
                                    'height': 0
                                }, 300);

                            }
                        });



                        $('.index').click(function () {
                            $(".menuson li.active").removeClass("active");
                            $('.menuson').animate({
                                'height': 0
                            }, 300);

                        });
                        //zw                
                        var Oul = $('#list1').find('.title').next('ul');

                        if (Oul.find('li').length > 0) {
                            var height1 = Oul.find('li').length * 30;

                            Oul.css('height', height1);

                            Oul.find('a')[0].click();

                        }



                        //zw-end

                    })

                },
                error: function (data) {
                    alert("ajax错误");
                }
            });

        }


        $(window).resize(function () {
            $(".leftmenu").height(window.innerHeight);
        });

    </script>
</body>
</html>
